import axios from '@/utils/request';
const baseURL = process.env.VUE_APP_MAINTENANCE_API;
const deviceURL = process.env.VUE_APP_DEVICE_API;

// 获取物模型列表
const getModelList = data =>  axios.request({
  method: 'GET',
  url: deviceURL + '/device/getModelList',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: false
  }
});

// 修改报警规则
const modifyRule = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/updateAlarmRule',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取物模型详情
const getModelDetail = data =>  axios.request({
  method: 'GET',
  url: deviceURL + '/device/getModelVariable',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取报警规则详情
const getAlarmDetail = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getAlarmRuleDetail',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 创建报警通知设置
const createAlarmNotice = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/createNoticeSetting',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 修改报警通知设置
const modifyAlarmNotice = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/updateNoticeSetting',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 创建报警规则
const createRule = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/addAlarmRule',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 报警通知设置列表
const getNoticeRuleList = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getNoticeSettingList',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 创建报警通知
const createNoticeInfo = data =>  axios.request({
  method: 'POST',
  url: baseURL + '/maintenance/createNoticeSetting',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取通知设置详情
const getNoticeDetail = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getNoticeSettingDetail',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 获取接收人信息列表
const getPersonList = data =>  axios.request({
  method: 'GET',
  url: baseURL + '/maintenance/getUserIdsByCustomerId',
  params: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 报警通知设置修改
const modifyNoticeSetting = data =>  axios.request({
  method: 'PUT',
  url: baseURL + '/maintenance/updateNoticeSetting',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});

// 删除报警规则
const deleteRule = data =>  axios.request({
  method: 'DELETE',
  url: baseURL + '/maintenance/deleteAlarmRule',
  data: data,
  headers: {
      'Content-Type': 'application/json',
      hideLoading: true
  }
});


export { getModelList,modifyRule,getAlarmDetail,deleteRule, getNoticeRuleList, createAlarmNotice, modifyAlarmNotice, getPersonList, createNoticeInfo, getModelDetail,createRule, modifyNoticeSetting, getNoticeDetail };
